package com.demoworld.demo3;

import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;

/**
 * Created by francis on 2017/8/18.
 */
public class UserDataFetcher implements DataFetcher<User> {
    @Override
    public User get(DataFetchingEnvironment dataFetchingEnvironment) {
        ZyVo sourceData = (ZyVo) dataFetchingEnvironment.getSource();
        long id = sourceData.getId();// TODO: 2017/8/18 可以根据不同的id 查询不同的用户信息
        User user = new User();
        user.setName("francis");
        user.setAge(12);
        user.setId(1234);
        return user;
    }
}
